package com.tj.template.application.trade.input;

import com.fqgj.common.api.ParamsObject;
import com.fqgj.common.utils.StringUtils;
import com.tj.bo.common.conf.util.ParamsValidateUtil;
import com.tj.bo.trade.client.enums.TradeTypeEnum;

/**
 * @program: binary-option
 * @description
 * @author: binary
 * @create: 2020-06-15 17:51
 **/
public class OpeningTradeRequest extends ParamsObject {

    /**
     * 交易类型
     */
    private Integer tradeType;
    /**
     * 产品code
     */
    private String productCode;

    public String getProductCode() {
        return productCode;
    }

    public OpeningTradeRequest setProductCode(String productCode) {
        this.productCode = productCode;
        return this;
    }

    public Integer getTradeType() {
        return tradeType;
    }

    public OpeningTradeRequest setTradeType(Integer tradeType) {
        this.tradeType = tradeType;
        return this;
    }

    @Override
    public void validate() {
        ParamsValidateUtil.checkParams(TradeTypeEnum.getEnumByCode(tradeType) == null , "tradeType is invalid");
        ParamsValidateUtil.checkParams(StringUtils.isEmpty(productCode), "productCode can not be empty");
    }
}
